package com.hkbigdata.sybx.controller;

import com.hkbigdata.sybx.service.UserPhoneService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author yangjing
 * @creat 2025-05-27-8:52
 * @email 3010335359@qq.com
 */
@RestController
@RequestMapping("/api/userRegedit")
public class UserPhoneController {

    private final UserPhoneService userPhoneService;

    public UserPhoneController(UserPhoneService userPhoneService) {
        this.userPhoneService = userPhoneService;
    }

    /**
     * 根据用户ID获取手机号
     * @param userId 用户ID
     * @return JSON格式的结果
     */
    @GetMapping("/phone/{userId}")
    public Map<String, Object> getPhoneByUserId(@PathVariable String  userId) {
        return userPhoneService.getPhoneByUserId(userId);
    }

    /**
     * 获取所有用户手机号
     * @return JSON格式的结果列表
     */
    @GetMapping("/phones")
    public Map<String, Object> getAllUserPhones() {
        return userPhoneService.getAllUserPhones();
    }
}